﻿IF EXISTS (SELECT * from sys.procedures p left join sys.schemas s on p.schema_id = s.schema_id where p.name='contact_insert' and s.name='Crm')
DROP PROCEDURE [Crm].contact_insert
GO
CREATE PROCEDURE [Crm].contact_insert 
@PK uniqueidentifier, 
@AccountID uniqueidentifier, 
@Title nvarchar(100), 
@Name nvarchar(100), 
@GivenName nvarchar(100), 
@Function nvarchar(100), 
@Phone1 nvarchar(15), 
@Phone2 nvarchar(15), 
@Fax nvarchar(15), 
@Mail nvarchar(100), 
@Address nvarchar(500), 
@ZipCode nvarchar(5), 
@City nvarchar(100), 
@Country nvarchar(100), 
@UseAccountInfos bit
AS
BEGIN
INSERT INTO [Crm].[Contacts]
([id_contact], [id_account], [title], [name], [given_name], [function], [phone1], [phone2], [fax], [mail], [address], [zip_code], [city], [country], [use_account_infos])
VALUES (@PK,@AccountID,@Title,@Name,@GivenName,@Function,@Phone1,@Phone2,@Fax,@Mail,@Address,@ZipCode,@City,@Country,@UseAccountInfos)
END